home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / tclib20.zip / MATHHK.H < prev    next >
C/C++ Source or Header  |  1988-12-03  |  2KB  |  44 lines

  1. /* TCHK 2.0 - Howard Kapustein's Turbo C library       12-3-88 */
  2. /* Copyright (C) 1988, Howard Kapustein.  All rights reserved. */
  3.  
  4. /* mathhk.h  -  header file for MATHHK.C - math functions */
  5.  
  6. #ifndef MATHHK_HEADER
  7. #define MATHHK_HEADER   1
  8.  
  9. #ifndef MATH_HK
  10.  
  11. #define SQRT2   1.41421356237309504880
  12. #define PI  3.141592653589793238462643
  13. #define E   2.7182818284590452353602874
  14.  
  15. #define sqr(x)      ((x) * (x))
  16. #define isgn(x)     ((x) < 0 ? -1 : 1)
  17. #define lsgn(x)     ((x) < 0l ? -1 : 1)
  18. #define fsgn(x)     ((x) < 0.0 ? -1 : 1)
  19. #define sgn(x)      isgn(x)
  20. #define sign(x)     isgn(x)
  21. #define lsign(x)    lsgn(x)
  22. #define fsign(x)    fsgn(x)
  23. #define swap(x,y)   (x ^= y, y^= x, x^=y)
  24. #define mid(a,x,b)  ((((a) <= (x)) && ((x) <= (b))) ? 1 : 0)
  25.  
  26. #define MAXFLOAT           3.4E+38
  27. #define MAXDOUBLE          1.7E+308
  28. #define MAXLONG            2147483647   /* 2,147,483,647 */
  29. #define MAXLONG_UNSIGNED   4294967295   /* 4,294,967,295 */
  30.  
  31. #define MATH_HK   1
  32. #endif
  33.  
  34. /* function prototypes */
  35. double round(double x, int n);         /* round x to n decimal places */
  36. double frac(double x);                 /* return fractional portion of real */
  37. double factorial(int n);               /* n! */
  38. int summation(int max);                /* Σ: 1+2+...+max */
  39. double average(int n, double element[]);    /* average (mean) */
  40. double variance(int n, double element[]);   /* variance */
  41. double stddev(int n, double element[]);     /* standard deviation */
  42.  
  43. #endif              /* MATHHK_HEADER */
  44.